
# str_a = 'today is a good day'
# print(str_a.split())

# list_a = ['today', 'is', 'a', 'good', 'day']
# str_b = ' '.join(list_a)
# print(str_b)

# print(list(str_a))

# str_b = '''
# 长亭外
# 古道边
# 芳草碧连天
# '''

# print(str_b.split())
# print(str_a.split('o'))


# for num in range(100,1000):
#     #方法一
#     # baiwei = int(str(num)[0])
#     # shiwei = int(str(num)[1])
#     # gewei = int(str(num)[2])
    
#     #方法二
#     baiwei = num // 100
#     shiwei = num // 10 % 10
#     gewei = num % 10
#     if num == baiwei ** 3 + shiwei ** 3 + gewei ** 3:
#         print(num,'是水仙花数')

# for num in range(1,256 + 1):
#     a = num ** 2
#     a = str(a)
#     b = a[::-1]
#     if a == b:
#         print(num,'是回文数')


'''
找出256以内所有与7有关的数字，这些数字包括：
可以被7整除		例如：21
各个位数之和为7	例如：43
位数中包含7		例如：57
'''
# for num in range(1,256+1):
#     baiwei = num // 100
#     shiwei = num // 10 % 10
#     gewei = num % 10
    
#     if num % 7 == 0 and baiwei + shiwei + gewei == 7 and str(num).count('7') > 0:
#         print(num)

# #圆面积
# def circle(r,pi = 3.14):
#     return pi * r ** 2
# #矩形面积
# def rect(w,h = None):
#     if h == None:
#         h = w
#     return w * h

# print('面积是',circle(5))
# print('面积是',rect(5))

# def get_list(s = 0,k = 10, step = 1):
#     result = []
#     item = s
#     while len(result) < k:
#         result.append(item)
#         item = item + step
#     return result

# print(get_list(3,5,7))
# print(get_list())
# print(get_list(2,s=5))

# #自定义幂运算函数，可开方(sq传True)
# def my_pow(n,p=2,sq = False):
#     if sq:
#         return n ** (1/p)
#     else:
#         return n ** p

# print(my_pow(2))
# print(my_pow(2,3))
# print(my_pow(2,2,True))

# print(list(enumerate([1,2,3,3,2,1])))

# a = ('one','two','three','four','five')
# for yi,er in enumerate(a):
#     print('{}:{}'.format(yi,er))
# b = ['星期一','星期二','星期三']
# print(dict(zip(a,b)))


# a = [1,2,3,4,5,6,7,8,9]
# b = [2,3,4,5,6,7,8,9,10]
# res = map(lambda x,y : x + y,a,b)
# print(list(res))

# res1 = filter(lambda x: x >=0 and x % 2 == 0,a)
# print(list(res1))

# import random
# #BMI指数
# height = random.choices(range(150,190),k=20)
# weight = random.choices(range(40,100),k=20)
# # print(height,weight)
# result = list(map(lambda x,y: y/(x/100)**2,height,weight))

# print(list(filter(lambda x: x >= 24,result)))

